package com.domino.server.persistence.gamesession;

import java.util.Date;
import java.util.List;

import javax.persistence.OptimisticLockException;

import com.domino.server.cache.GameSessionData;
import com.domino.shared.Player;
import com.domino.shared.PlayerId;
import com.domino.shared.session.SessionId;

public interface GameSessionDao {

	void create(GameSessionData gsd);

	void update(GameSessionData gsd) throws OptimisticLockException;

	GameSessionData findByNaturalId(SessionId sessionId);
	
	GameSessionData findPendingOrRunningPlayer(PlayerId playerId);

	List<GameSessionData> findByState(int state,int maxResultSet);

	List<GameSessionData> findByDateTimeIntervall(Date from, Date to,int maxSize);

	List<GameSessionData> findByDateTimeIntervallAndState(Date from, Date to,
			int state, Integer maxSize);

	int countByState(int state);

}